#ifndef _LOG_H
#define _LOG_H

#include <iostream>
#include "state/Settings.hpp"

#define _HARDCODED_LOG_ENABLED


namespace Log
{
  void Init ();

  void ReadLogLevel ();

  std::ostream& GetInfoStream();

  std::ostream& GetErrorStream();
}

#define _FILE_AND_LINE "\n-- " << __FILE__ << " : " << __LINE__ << " : "

#define LOG_INFO Log::GetInfoStream() << "\n>> INFO:" << _FILE_AND_LINE

#define LOG_DEBUG Log::GetInfoStream() << "\n>> DEBUG:" << _FILE_AND_LINE

#define LOG_ERROR Log::GetErrorStream() << "\n>> ERROR:" << _FILE_AND_LINE  

namespace mi
{
  class _DebugFunction
  {
  public:
      _DebugFunction(std::string function, std::string file, int line)
      {
          _fun = function;
          _file = file;
          _line = line;
          Log::GetInfoStream() << "\n--" << _file << " : " << _line << " : " << "Entering " << _fun;
      }
      ~_DebugFunction()
      {
        Log::GetInfoStream() << "\n--" << _file << " : " << _line << " : " << "Exiting " << _fun << " in " << cl.getElapsedTime().asSeconds();
      }
  private:
      std::string _fun, _file;
      int  _line;
      sf::Clock cl;
  };
}

#define DBG_FN mi::_DebugFunction __dbgfun(__FUNCTION__, __FILE__, __LINE__);

#endif